<?php
namespace tp5_lib\common\controller;

use think\Controller;

/**
 * 测试控制器的基类
 * 这种控制器在非调试状态下不能调用
 * 直接将结果输出到屏幕上，不要返回成功或失败页面，否则自动跳转功能很影响调试
 */
class TestBaseController extends Controller
{
    protected function initialize()
    {
        header('Content-Type: text/plain');
    }
    protected function success($msg = '', $url = null, $data = '', $wait = 3, array $header = [])
    {
        echo "成功:" . $msg; exit;
    }
    protected function error($msg = '', $url = null, $data = '', $wait = 3, array $header = [])
    {
        echo "失败:" . $msg; $msg;exit;
    }
    protected function result($data, $code = 0, $msg = '', $type = '', array $header = [])
    {
        print_r($data);exit;
    }
}
